import Vue from 'vue';
import Router from 'vue-router';

Vue.use(Router);

const router = new Router({
    routes: [
        {
            path: '/',
            redirect: '/dashboard'
        },
        {
            path: '/',
            component: () => import(/* webpackChunkName: "home" */ '../components/common/Home.vue'),
            meta: { title: '自述文件' },
            children: [
                // =========首页=========
                {
                    path: '/dashboard',
                    component: () => import(/* webpackChunkName: "dashboard" */ '../components/page/Dashboard.vue'),
                    meta: { title: '系统首页' }
                },
                // =========用户管理=========
                {
                    path: '/user',
                    component: () => import(/* webpackChunkName: "404" */ '../components/page/UserManager/UserList.vue'),
                    meta: { title: '用户列表' }
                },
                // =========商户管理=========
                {
                    path: '/merchant',
                    component: () => import(/* webpackChunkName: "404" */ '../components/page/BusinessesManager/BusinessesManager.vue'),
                    meta: { title: '商户管理' }
                },
                {
                    path: '/merchantpm',
                    component: () => import(/* webpackChunkName: "404" */ '../components/page/BusinessesManager/BusinessesRanking.vue'),
                    meta: { title: '商户排名' }
                },
                {
                    path: '/managerindex',
                    component: () => import('../components/page/BusinessesManager/BusinessesManagerIndex.vue'),
                    meta: { title: '商户详情', isShowFatherRoute: true }
                },
                // =========服务管理=========
                {
                    path: '/service',
                    component: () => import(/* webpackChunkName: "404" */ '../components/page/ServeManager/ServeManager.vue'),
                    meta: { title: '服务管理' }
                },
                {
                    path: '/servicetype',
                    component: () => import(/* webpackChunkName: "404" */ '../components/page/ServeManager/ServeType.vue'),
                    meta: { title: '服务类别' }
                },
                {
                    path: '/addserve',
                    component: () => import(/* webpackChunkName: "404" */ '../components/page/ServeManager/AddServe.vue'),
                    meta: { title: '发布服务', isShowFatherRoute: true }
                },
                // =========订单管理=========
                {
                    path: '/indentclear',
                    component: () => import(/* webpackChunkName: "404" */ '../components/page/OrderManager/CarWashOrder.vue'),
                    meta: { title: '洗车订单' }
                },
                {
                    path: '/indentmaintain',
                    component: () => import(/* webpackChunkName: "404" */ '../components/page/OrderManager/MaintenanceOrder.vue'),
                    meta: { title: '维修订单' }
                },
                {
                    path: '/indenthealth',
                    component: () => import(/* webpackChunkName: "404" */ '../components/page/OrderManager/UpkeepOrder.vue'),
                    meta: { title: '保养订单' }
                },
                {
                    path: '/indentjudge',
                    component: () => import(/* webpackChunkName: "404" */ '../components/page/OrderManager/AppraiseManager.vue'),
                    meta: { title: '评价管理' }
                },
                {
                    path: '/orderdetails',
                    component: () => import(/* webpackChunkName: "404" */ '../components/page/OrderManager/OrderDetails.vue'),
                    meta: { title: '订单详情', isShowFatherRoute: true }
                },
                // =========救援任务=========
                {
                    path: '/rescue',
                    component: () => import(/* webpackChunkName: "404" */ '../components/page/Rescue/Rescue.vue'),
                    meta: { title: '救援任务' }
                },
                // =========信息发布=========
                {
                    path: '/notice',
                    component: () => import(/* webpackChunkName: "404" */ '../components/page/MessagePublish/MessagePublish.vue'),
                    meta: { title: '信息发布' }
                },
                {
                    path: '/unstatus',
                    component: () => import(/* webpackChunkName: "404" */ '../components/page/MessagePublish/ToBeReviewed.vue'),
                    meta: { title: '待审核' }
                },
                {
                    path: '/onstatus',
                    component: () => import(/* webpackChunkName: "404" */ '../components/page/MessagePublish/Reviewed.vue'),
                    meta: { title: '已审核' }
                },
                {
                    path: '/postmessage',
                    component: () => import(/* webpackChunkName: "404" */ '../components/page/MessagePublish/PostMessage.vue'),
                    meta: { title: '发布信息', isShowFatherRoute: true }
                },
                {
                    path: '/details',
                    component: () => import(/* webpackChunkName: "404" */ '../components/page/MessagePublish/Details.vue'),
                    meta: { title: '信息详情', isShowFatherRoute: true }
                },

                // =========订单统计=========
                {
                    path: '/indentInfoView',
                    component: () => import(/* webpackChunkName: "404" */ '../components/page/OrderStatistics/OrderStatistics.vue'),
                    meta: { title: '订单统计' }
                },
                // =========系统管理=========
                {
                    path: '/systemMenus',
                    component: () => import(/* webpackChunkName: "404" */ '../components/page/SystemManager/SystemMenu.vue'),
                    meta: { title: '系统菜单' }
                },
                {
                    path: '/systemUser',
                    component: () => import(/* webpackChunkName: "404" */ '../components/page/SystemManager/SystemUser.vue'),
                    meta: { title: '系统用户' }
                },
                {
                    path: '/systemRole',
                    component: () => import(/* webpackChunkName: "404" */ '../components/page/SystemManager/SystemRole.vue'),
                    meta: { title: '系统角色' }
                },
                {
                    path: '/dictionary',
                    component: () => import(/* webpackChunkName: "404" */ '../components/page/SystemManager/DataDictionary.vue'),
                    meta: { title: '数据字典' }
                },
            ]
        },
        {
            path: '/login',
            component: () => import(/* webpackChunkName: "login" */ '../components/page/Login.vue'),
            meta: { title: '登录' }
        },
        {
            path: '*',
            redirect: '/404'
        }
    ]
});
const originalPush = Router.prototype.push;
Router.prototype.push = function (location) {
    return originalPush.call(this, location).catch(err => err)
};

export default router
